package com.qiche.service.impl;

import com.qiche.model.SpecialOffer;
import com.qiche.service.SpecialOfferService;
import org.springframework.stereotype.Service;
import tk.mybatis.mapper.entity.Example;

import java.util.List;

/**
 * Created by Linzw on 2018/01/24.
 */
@Service("specialOfferService")
public class SpecialOfferServiceImpl extends BaseService<SpecialOffer> implements SpecialOfferService {



    @Override
    public SpecialOffer selectByMerchantId(Integer merchantId) {
        Example example=new Example(SpecialOffer.class);
        Example.Criteria criteria=example.createCriteria();
        criteria.andEqualTo("merchantId",merchantId);
        List<SpecialOffer> offerList=mapper.selectByExample(example);
        if(!offerList.isEmpty()){
            return  offerList.get(0);
        }
        return null;
    }
}
